//create by: 邓志锋 <280160522@qq.com> <https://www.diygw.com> DIY官网可视化一键生成
Page({
	data: {
		collapse1Index: ['0'],
		text4: `内容1`,
		text5: `内容2`,
		text6: `内容3`,
		collapse2Index: ['0'],
		text8: `内容1`,
		text9: `内容2`,
		text10: `内容3`,
		collapseIndex: ['0'],
		text: `内容1`,
		text1: `内容2`,
		text2: `内容3`
	},
	onLoad(option) {
		if (option) {
			this.setData({
				globalOption: option
			});
		}
	},
	onShow() {
		this.init();
	},
	async init() {},
	changeCollapse1(evt) {
		let { index } = evt.currentTarget.dataset;
		let collapse1Index = this.data.collapse1Index;
		if (collapse1Index.includes(index)) {
			let findIndex = collapse1Index.findIndex((item) => {
				return item == index;
			});
			collapse1Index.splice(findIndex, 1);
		} else {
			collapse1Index.push(index);
		}
		this.setData({ collapse1Index });
	},
	changeCollapse2(evt) {
		let { index } = evt.currentTarget.dataset;
		let collapse2Index = this.data.collapse2Index;
		collapse2Index[0] = index;
		this.setData({ collapse2Index });
	},
	changeCollapse(evt) {
		let { index } = evt.currentTarget.dataset;
		let collapseIndex = this.data.collapseIndex;
		collapseIndex[0] = index;
		this.setData({ collapseIndex });
	}
});
